#include <iostream>
using namespace std;
int main()
{
    int n,m;
    string str=" ";
    cout<<"请输入整数>>";cin>>n;
    cout<<"请输入数制>>";cin>>m;
    while(n>0){
        str.push_back(n%m+'0');
        n/=m;
    }
    int len=str.length()/2;
    for(int i=0;i<len;i++){
        char tmp=str[i];
        str[i]=str[str.length()-i-1];
        str[str.length()-i-1]=tmp;
    }
    cout<<str<<endl;
    return 0;
}